package com.service.xsxt;

import com.dao.xsxt.SeasonMapper;
import com.entity.common.ApiResult;
import com.entity.xsxt.Season;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by System on 2019/04/15 09:37:07.
 */
@Service
public class SeasonService {

    @Autowired
    private SeasonMapper seasonMapper;

    public List<Season> getPageList(Season season){
        return seasonMapper.getPageList(season);
    }

    public ApiResult addSeason(Season season) {
        int num = seasonMapper.insertSelective(season);
        return  new ApiResult(num);
    }

    public ApiResult getSeasonById(Long id) {
        Season season = seasonMapper.selectByPrimaryKey(id);
        return new ApiResult(true,"获取数据成功！",season);
    }

    public ApiResult editSeason(Season season) {
        int num = seasonMapper.updateByPrimaryKeySelective(season);
        return  new ApiResult(num);
    }

    public ApiResult deleteSeason(Long id) {
        int num = seasonMapper.deleteByPrimaryKey(id);
        return  new ApiResult(num);
    }
}
